package com.oa.system.service;

import com.joneying.common.web.response.Resp;
import com.oa.core.PageResult;
import com.oa.core.exception.BusinessException;
import com.oa.core.exception.DataIsEmptyException;
import com.oa.system.dto.MailListDTO;
import com.oa.system.dto.UserAddDTO;
import com.oa.system.dto.UserListDTO;
import com.oa.system.entity.User;
import com.baomidou.mybatisplus.service.IService;
import com.oa.system.vo.*;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author syb123
 * @since 2019-01-29
 */
public interface IUserService extends IService<User> {

    Resp<UserVO> login(String ticket) throws IOException;

    Resp<UserVO> wxlogin(String ticket);

    /**
     * 添加用户
     *
     * @param userAddDTO
     * @return
     */
    Resp addUser(UserAddDTO userAddDTO) throws BusinessException;

    /**
     * 根据条件查询用户列表
     *
     * @param page
     * @param limit
     * @param userName
     * @param name
     * @param createTime
     * @param organizationName
     * @return
     */
    PageResult<UserVO> findUserListByCondition(Integer page, Integer limit, String userName, String name, String createTime, String organizationName) throws DataIsEmptyException;

    /**
     * 根据id查询用户详情
     *
     * @param id
     * @return
     */
    Resp findUserDetailsById(String id) throws DataIsEmptyException;

    /**
     * 根据id修改用户
     *
     * @param userUpdateVO
     * @return
     */
    Resp updateUserDetailsById(UserUpdateVO userUpdateVO) throws BusinessException;

    /**
     * 根据ids启用或者禁用用户
     *
     * @param ids
     * @param type
     * @return
     */
    Resp EnableOrDisableUserById(String ids, String type) throws BusinessException;

    /**
     * 根据id删除用户
     *
     * @param id
     * @return
     */
    Resp deleteUserById(String id) throws DataIsEmptyException, BusinessException;

    /**
     * 查询用户列表
     * @param
     * @param
     * @return
     */
    PageResult<UserListVO> findUserList(UserListDTO userListDTO);

    /**
     * 通讯录
     * @return
     */
    PageResult<MailListVO> findMailList(MailListDTO<MailListVO> mailListDTO);


    List<UserByOrganizationVO> findUserByOrganization(String departmentId, String companyId);

    Integer findRanking(String id, String createTimeYear);

    void exportMailList(HttpServletResponse response);

}
